package com.test.mylotterysystem.controller;

import com.test.mylotterysystem.controller.Param.DrawPrizeParam;
import com.test.mylotterysystem.service.DrawPrizeService;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/draw")
@RestController
@Slf4j
public class DrawPrizeController {

    @Autowired
    private DrawPrizeService drawPrizeService;


    /**
     * 将前端传递过来的数据存储到rabbitMQ中
     * @param drawPrizeParam
     * @return
     */
    @RequestMapping("prize")
    public Boolean drawPrize(@Validated @RequestBody DrawPrizeParam drawPrizeParam) {
        log.info("drawPrizeParam为：{}",drawPrizeParam);
        drawPrizeService.drawPrize(drawPrizeParam);
        return true;
    }

}
